package frameworks

import (
	"fmt"
	"gitee.com/xixigroup/sweet-tools/base/interfaces"
	"gitee.com/xixigroup/sweet-tools/base/logger"
	"github.com/gin-gonic/gin"
	"net/http"
)

type Handler interface {
	Get()
	Post()
	Put()
	Delete()
}

type Launcher struct {
	Config *interfaces.Config
	router *gin.Engine
}

func (l *Launcher) Start() {

	baseConf := l.Config.GetBaseConf()
	addr := fmt.Sprintf("%s:%s", baseConf.Host, baseConf.Port)
	logger.Infof("Listening on %s %s", addr, conf.Environment)

	s := &http.Server{
		Addr:    addr,
		Handler: l.router,
	}
	s.ListenAndServe()
}
